import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/Login'),
  },
  {
    path: '/',
    name: 'Dashboard',
    component: () => import('@/views/dashboard.vue'),
    children: [
      {
        path: '',
        name: 'redirect',
        component: () => import('@/views/redirect'),
      },
      {
        path: '/main',
        name: 'main',
        component: () => import('@/views/main'),
      },
      {
        path: '/device',
        name: 'device',
        component: () => import('@/views/device/device'),
      },
      {
        path: '/product',
        name: 'product',
        component: () => import('@/views/product/product'),
      },
      {
        path: '/productDetail',
        name: 'productDetail',
        component: () => import('@/views/product/productDetail'),
      },
      {
        path: '/deviceDetail',
        name: 'deviceDetail',
        component: () => import('@/views/device/deviceDetail'),
      },
      {
        path: '/deviceCommon',
        name: 'deviceCommon',
        component: () => import('@/views/device/deviceCommon'),
      },
      {
        path: '/deviceDetailProfileGC',
        name: 'deviceDetailProfileGC',
        component: () => import('@/views/device/deviceDetailProfileGC'),
      },
      {
        path: '/deviceData',
        name: 'deviceData',
        component: () => import('@/views/device/deviceData'),
      },
      {
        path: '/deviceDataProfileGC',
        name: 'deviceDataProfileGC',
        component: () => import('@/views/device/deviceDataProfileGC'),
      },
      {
        path: '/organization/user',
        name: 'organization/user',
        component: () => import('@/views/organization/user/user'),
      },
      {
        path: '/organization/menu',
        name: 'organization/menu',
        component: () => import('@/views/organization/menu/menu'),
      },
      {
        path: '/organization/role',
        name: 'organization/role',
        component: () => import('@/views/organization/role/role'),
      },
      {
        path: '/mobile-user/list',
        name: 'mobile-user/list',
        component: () => import('@/views/mobile/mobileUserList'),
      },
      {
        path: '/mobile-user/total',
        name: 'mobile-user/total',
        component: () => import('@/views/mobile/total'),
      },
      {
        path: 'setting',
        name: 'setting',
        meta: { breadcrumb: [{ name: '个人中心' }, { name: ' 个人设置' }] },
        component: () => import('@/views/setting'),
      },
      {
        path: '*',
        name: 'notFound',
        component: () => import('@/views/404'),
      },
    ],
  },
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;
